package com.yonyou.cloud.member.domainmodel.dto;

import com.yonyou.cloud.member.domainmodel.vo.TimeRange;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.time.LocalDateTime;

@ApiModel(description = "时间范围")
public class TimeRangeDto {
    @ApiModelProperty(value = "从时间")
    @lombok.Setter
    private LocalDateTime fromTime;
    @ApiModelProperty(value = "到时间")
    @lombok.Setter
    private LocalDateTime toTime;

    /**
     * 转换为TimeRange类型，ValueObject，不可变
     * @return TimeRange 时间范围
     */
    public TimeRange getTimeRange() {
        return new TimeRange(fromTime, toTime);
    }

    public void setFromTime(LocalDateTime fromTime) {
        this.fromTime = fromTime;
    }

    public void setToTime(LocalDateTime toTime) {
        this.toTime = toTime;
    }
}
